package edu.ccut.saturn.component.impl;

import java.util.ArrayList;
import java.util.List;

import edu.ccut.saturn.component.IAuthorityResourceInfo;
import edu.ccut.saturn.component.IAuthorityRoleInfo;
import edu.ccut.saturn.component.IBundleAuthorityInfo;

public class SaturnBundleAuthorityInfo implements IBundleAuthorityInfo {

	private String bundleSymbolicName;

	private List<IAuthorityResourceInfo> resourceInfos;

	private List<IAuthorityRoleInfo> roleInfos;

	public SaturnBundleAuthorityInfo(String bundleSymbolicName) {
		this.bundleSymbolicName = bundleSymbolicName;
		resourceInfos = new ArrayList<IAuthorityResourceInfo>();
		roleInfos = new ArrayList<IAuthorityRoleInfo>();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see edu.ccut.saturn.component.impl.IBundleAuthorityInfo#setResourceInfos(java.util.List)
	 */
	public void setResourceInfos(List<IAuthorityResourceInfo> resourceInfos) {
		this.resourceInfos = resourceInfos;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see edu.ccut.saturn.component.impl.IBundleAuthorityInfo#setRoleInfos(java.util.List)
	 */
	public void setRoleInfos(List<IAuthorityRoleInfo> roleInfos) {
		this.roleInfos = roleInfos;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see edu.ccut.saturn.component.impl.IBundleAuthorityInfo#getBundleSymbolicName()
	 */
	public String getBundleSymbolicName() {
		return bundleSymbolicName;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see edu.ccut.saturn.component.impl.IBundleAuthorityInfo#setBundleSymbolicName(java.lang.String)
	 */
	public void setBundleSymbolicName(String bundleSymbolicName) {
		this.bundleSymbolicName = bundleSymbolicName;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see edu.ccut.saturn.component.impl.IBundleAuthorityInfo#getResourceInfos()
	 */
	public List<IAuthorityResourceInfo> getResourceInfos() {
		return this.resourceInfos;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see edu.ccut.saturn.component.impl.IBundleAuthorityInfo#getRoleInfos()
	 */
	public List<IAuthorityRoleInfo> getRoleInfos() {
		return this.roleInfos;
	}

	public void initAuthorityInfo(IBundleAuthorityInfo bundleAuthorityInfo) {

		if (bundleAuthorityInfo != null) {
			this.resourceInfos = bundleAuthorityInfo.getResourceInfos();
			this.roleInfos = bundleAuthorityInfo.getRoleInfos();
		}
	}
}
